package com.internetCafes.spms.web.certificate.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;


/**
 * 证书信息表
 *
 * @author Sunny
 * @email rekeeper2011@hotmail.com
 * @date 2020-04-13 14:18:33
 */
@Data
public class CertificateInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 证书表id
     */
    private Long id;

    /**
     * 证书类型 1在职员工,2挂靠，3非在职员工
     */
    private Integer certificateType;

    /**
     * 员工ID
     */
    private Long employeeId;

    /**
     * 证书类型大类
     */
    private String pIdType;

    /**
     * 证书类型小类
     */
    private String idType;

    /**
     * 专业
     */
    private String profession;

    /**
     * 挂入人
     */
    private Long affiliationEmployee;

    /**
     * 注册类型
     */
    private Integer registerType;

    /**
     * 证书名称
     */
    private String certificateName;

    /**
     * 证书配置ID
     */
    private Long certificateConfId;

    /**
     * 证书号
     */
    private String certificateNo;

    /**
     * 执业证书号
     */
    private String certifiedNo;

    /**
     * 发证日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date releaseTime;

    /**
     * 有效期结束时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date validityEndTime;

    /**
     * 1长期有效,0非长期有效
     */
    private Integer longTerm;

    /**
     * 借入时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date borrowTime;

    /**
     * 借入到期时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date borrowEndTime;

    /**
     * 借入来源   1-个人 2-公司/其他
     */
    private Integer borrowCandidatesSources;

    /**
     * 借入来源单位
     */
    private String borrowOrgName;

    /**
     * 借入联系人
     */
    private String borrowContact;

    /**
     * 借入联系人关系
     */
    private String borrowContactRelationship;

    /**
     * 借入联系电话
     */
    private String borrowContactMobile;

    /**
     * 最初保管单位ID
     */
    private Long oriKeepDeptId;

    /**
     * 最初保管单位名称
     */
    private String oriKeepDeptName;

    /**
     * 最初保管人ID
     */
    private Long oriKeepUserId;

    /**
     * 最初保管人姓名
     */
    private String oriKeepUserName;

    /**
     * 联系电话
     */
    private String oriKeepContactMobile;

    /**
     * 保管单位ID
     */
    private Long keepDeptId;

    /**
     * 保管单位名称
     */
    private String keepDeptName;

    /**
     * 保管人ID
     */
    private Long keepUserId;

    /**
     * 保管人姓名
     */
    private String keepUserName;

    /**
     * 保管联系电话
     */
    private String keepContactMobile;

    /**
     * 延期次数
     */
    private Integer renewalNum;

    /**
     * 延期时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date renewalTime;

    /**
     * 备注信息
     */
    private String remark;

    /**
     * 状态:-1删除,0空闲,1挂出,21投标,22项目
     */
    private Integer status;

    /**
     * 返还时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date returnTime;

    /**
     * 创建者
     */
    private Long createBy;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    /**
     * 更新人
     */
    private Long updateBy;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date updateTime;

    /**
     * 考试时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date examTime;

    /**
     * 考试地点
     */
    private String examLocation;

    /**
     * 考试成绩
     */
    private Integer examGrade;

    /**
     * 人才费用
     */
    private double affiliationExpend;

    /**
     * 是否通过中介:1是,0否
     */
    private Integer agencyFlag;

    /**
     * 中介名称
     */
    private String agencyName;

    /**
     * 中介费用
     */
    private double examAgencyFee;

    /**
     * 考试是否通过中介:1是,0否
     */
    private Integer examAgencyFlag;

    /**
     * 考试中介名称
     */
    private String examAgencyName;

    /**
     * 考试中介费用
     */
    private double agencyFee;

    /**
     * 考试费用
     */
    private double examFee;

    /**
     * 其他费用
     */
    private double otherFee;

    /**
     * 费用备注
     */
    private String feeRemark;

    /**
     * 总费用
     */
    private Double totalFee;

    /**
     * 是否已经支付:1是,0否
     */
    private Integer payFlag;

    /**
     * 支付时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date payTime;

    /**
     * 作废说明
     */
    private String enableRemark;

    private Long friendshipEmployeeId;

    /**
     * 租户id t_tenant_info
     */
    private Long tenantId;

    /**
     * 是否交税:1税前,0税后
     */
    private Integer tax;

    /**
     * 是否借出标签 1-是 0-否 默认为0
     */
    private Integer borrowOutFlag;

    /**
     * 借出时
     * 是否被押证 1-是 0-否 默认为0
     */
    private Integer warrantFlag;

    /**构造方法，使用在证书还回接口部分*/
    public CertificateInfo(Long id, Long keepDeptId,
                           String keepDeptName, Long keepUserId,
                           String keepUserName, String keepContactMobile, Integer status) {
        this.id = id;
        this.keepDeptId = keepDeptId;
        this.keepDeptName = keepDeptName;
        this.keepUserId = keepUserId;
        this.keepUserName = keepUserName;
        this.keepContactMobile = keepContactMobile;
        this.status = status;
    }

    public CertificateInfo() {
    }

    public double getExamAgencyFee() {
        return examAgencyFee;
    }

    public void setExamAgencyFee(double examAgencyFee) {
        this.examAgencyFee = examAgencyFee;
    }

    public Integer getExamAgencyFlag() {
        return examAgencyFlag;
    }

    public void setExamAgencyFlag(Integer examAgencyFlag) {
        this.examAgencyFlag = examAgencyFlag;
    }

    public String getExamAgencyName() {
        return examAgencyName;
    }

    public void setExamAgencyName(String examAgencyName) {
        this.examAgencyName = examAgencyName;
    }

    public String getEnableRemark() {
        return enableRemark;
    }

    public void setEnableRemark(String enableRemark) {
        this.enableRemark = enableRemark;
    }

    public Long getFriendshipEmployeeId() {
        return friendshipEmployeeId;
    }

    public void setFriendshipEmployeeId(Long friendshipEmployeeId) {
        this.friendshipEmployeeId = friendshipEmployeeId;
    }

    public String getBorrowContactRelationship() {
        return borrowContactRelationship;
    }

    public void setBorrowContactRelationship(String borrowContactRelationship) {
        this.borrowContactRelationship = borrowContactRelationship;
    }

    public Integer getTax() {
        return tax;
    }

    public void setTax(Integer tax) {
        this.tax = tax;
    }

    public Date getExamTime() {
        return examTime;
    }

    public String getpIdType() {
        return pIdType;
    }

    public void setpIdType(String pIdType) {
        this.pIdType = pIdType;
    }

    @JSONField(name = "exam_time")
    public void setExamTime(Date examTime) {
        this.examTime = examTime;
    }

    public String getExamLocation() {
        return examLocation;
    }

    @JSONField(name = "exam_location")
    public void setExamLocation(String examLocation) {
        this.examLocation = examLocation;
    }

    public Integer getExamGrade() {
        return examGrade;
    }

    @JSONField(name = "exam_grade")
    public void setExamGrade(Integer examGrade) {
        this.examGrade = examGrade;
    }

    public double getAffiliationExpend() {
        return affiliationExpend;
    }

    @JSONField(name = "affiliation_expend")
    public void setAffiliationExpend(double affiliationExpend) {
        this.affiliationExpend = affiliationExpend;
    }

    public Integer getAgencyFlag() {
        return agencyFlag;
    }

    @JSONField(name = "agency_flag")
    public void setAgencyFlag(Integer agencyFlag) {
        this.agencyFlag = agencyFlag;
    }

    public String getAgencyName() {
        return agencyName;
    }

    @JSONField(name = "agency_name")
    public void setAgencyName(String agencyName) {
        this.agencyName = agencyName;
    }

    public double getAgencyFee() {
        return agencyFee;
    }

    @JSONField(name = "agency_fee")
    public void setAgencyFee(double agencyFee) {
        this.agencyFee = agencyFee;
    }

    public double getExamFee() {
        return examFee;
    }

    @JSONField(name = "exam_fee")
    public void setExamFee(double examFee) {
        this.examFee = examFee;
    }

    public String getFeeRemark() {
        return feeRemark;
    }

    @JSONField(name = "fee_remark")
    public void setFeeRemark(String feeRemark) {
        this.feeRemark = feeRemark;
    }

    public Double getTotalFee() {
        if (totalFee==null){
            return affiliationExpend+agencyFee;
        }
        return totalFee;
    }

    @JSONField(name = "total_fee")
    public void setTotalFee(Double totalFee) {
        this.totalFee = totalFee;
    }

    public Integer getPayFlag() {
        return payFlag;
    }

    @JSONField(name = "pay_flag")
    public void setPayFlag(Integer payFlag) {
        this.payFlag = payFlag;
    }

    public Date getPayTime() {
        return payTime;
    }

    @JSONField(name = "pay_time")
    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    @JSONField(name = "id")
    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    @JSONField(name = "certificate_type")
    public void setCertificateType(Integer certificateType) {
        this.certificateType = certificateType;
    }

    public Integer getCertificateType() {
        return certificateType;
    }

    @JSONField(name = "employee_id")
    public void setEmployeeId(Long employeeId) {
        this.employeeId = employeeId;
    }

    public Long getEmployeeId() {
        return employeeId;
    }

    @JSONField(name = "p_id_type")
    public void setPIdType(String pIdType) {
        this.pIdType = pIdType;
    }

    public String getPIdType() {
        return pIdType;
    }

    @JSONField(name = "id_type")
    public void setIdType(String idType) {
        this.idType = idType;
    }

    public String getIdType() {
        return idType;
    }

    @JSONField(name = "profession")
    public void setProfession(String profession) {
        this.profession = profession;
    }

    public String getProfession() {
        return profession;
    }

    @JSONField(name = "register_type")
    public void setRegisterType(Integer registerType) {
        this.registerType = registerType;
    }

    public Integer getRegisterType() {
        return registerType;
    }

    @JSONField(name = "certificate_name")
    public void setCertificateName(String certificateName) {
        this.certificateName = certificateName;
    }

    public String getCertificateName() {
        return certificateName;
    }

    @JSONField(name = "certificate_conf_id")
    public void setCertificateConfId(Long certificateConfId) {
        this.certificateConfId = certificateConfId;
    }

    public Long getCertificateConfId() {
        return certificateConfId;
    }

    @JSONField(name = "certificate_no")
    public void setCertificateNo(String certificateNo) {
        this.certificateNo = certificateNo;
    }

    public String getCertificateNo() {
        return certificateNo;
    }

    @JSONField(name = "certified_no")
    public void setCertifiedNo(String certifiedNo) {
        this.certifiedNo = certifiedNo;
    }

    public String getCertifiedNo() {
        return certifiedNo;
    }

    @JSONField(name = "release_time")
    public void setReleaseTime(Date releaseTime) {
        this.releaseTime = releaseTime;
    }

    public Date getReleaseTime() {
        return releaseTime;
    }

    @JSONField(name = "validity_end_time")
    public void setValidityEndTime(Date validityEndTime) {
        this.validityEndTime = validityEndTime;
    }

    public Date getValidityEndTime() {
        return validityEndTime;
    }

    @JSONField(name = "borrow_time")
    public void setBorrowTime(Date borrowTime) {
        this.borrowTime = borrowTime;
    }

    public Date getBorrowTime() {
        return borrowTime;
    }

    @JSONField(name = "borrow_end_time")
    public void setBorrowEndTime(Date borrowEndTime) {
        this.borrowEndTime = borrowEndTime;
    }

    public Date getBorrowEndTime() {
        return borrowEndTime;
    }

    @JSONField(name = "borrow_candidates_sources")
    public void setBorrowCandidatesSources(Integer borrowCandidatesSources) {
        this.borrowCandidatesSources = borrowCandidatesSources;
    }

    public Integer getBorrowCandidatesSources() {
        return borrowCandidatesSources;
    }

    @JSONField(name = "borrow_org_name")
    public void setBorrowOrgName(String borrowOrgName) {
        this.borrowOrgName = borrowOrgName;
    }

    public String getBorrowOrgName() {
        return borrowOrgName;
    }

    @JSONField(name = "borrow_contact")
    public void setBorrowContact(String borrowContact) {
        this.borrowContact = borrowContact;
    }

    public String getBorrowContact() {
        return borrowContact;
    }

    @JSONField(name = "borrow_contact_mobile")
    public void setBorrowContactMobile(String borrowContactMobile) {
        this.borrowContactMobile = borrowContactMobile;
    }

    public String getBorrowContactMobile() {
        return borrowContactMobile;
    }

    @JSONField(name = "ori_keep_dept_id")
    public void setOriKeepDeptId(Long oriKeepDeptId) {
        this.oriKeepDeptId = oriKeepDeptId;
    }

    public Long getOriKeepDeptId() {
        return oriKeepDeptId;
    }

    @JSONField(name = "ori_keep_dept_name")
    public void setOriKeepDeptName(String oriKeepDeptName) {
        this.oriKeepDeptName = oriKeepDeptName;
    }

    public String getOriKeepDeptName() {
        return oriKeepDeptName;
    }

    @JSONField(name = "ori_keep_user_id")
    public void setOriKeepUserId(Long oriKeepUserId) {
        this.oriKeepUserId = oriKeepUserId;
    }

    public Long getOriKeepUserId() {
        return oriKeepUserId;
    }

    @JSONField(name = "ori_keep_user_name")
    public void setOriKeepUserName(String oriKeepUserName) {
        this.oriKeepUserName = oriKeepUserName;
    }

    public String getOriKeepUserName() {
        return oriKeepUserName;
    }

    @JSONField(name = "ori_keep_contact_mobile")
    public void setOriKeepContactMobile(String oriKeepContactMobile) {
        this.oriKeepContactMobile = oriKeepContactMobile;
    }

    public String getOriKeepContactMobile() {
        return oriKeepContactMobile;
    }

    @JSONField(name = "keep_dept_id")
    public void setKeepDeptId(Long keepDeptId) {
        this.keepDeptId = keepDeptId;
    }

    public Long getKeepDeptId() {
        return keepDeptId;
    }

    @JSONField(name = "keep_dept_name")
    public void setKeepDeptName(String keepDeptName) {
        this.keepDeptName = keepDeptName;
    }

    public String getKeepDeptName() {
        return keepDeptName;
    }

    @JSONField(name = "keep_user_id")
    public void setKeepUserId(Long keepUserId) {
        this.keepUserId = keepUserId;
    }

    public Long getKeepUserId() {
        return keepUserId;
    }

    @JSONField(name = "keep_user_name")
    public void setKeepUserName(String keepUserName) {
        this.keepUserName = keepUserName;
    }

    public String getKeepUserName() {
        return keepUserName;
    }

    @JSONField(name = "keep_contact_mobile")
    public void setKeepContactMobile(String keepContactMobile) {
        this.keepContactMobile = keepContactMobile;
    }

    public String getKeepContactMobile() {
        return keepContactMobile;
    }

    @JSONField(name = "renewal_num")
    public void setRenewalNum(Integer renewalNum) {
        this.renewalNum = renewalNum;
    }

    public Integer getRenewalNum() {
        return renewalNum;
    }

    @JSONField(name = "renewal_time")
    public void setRenewalTime(Date renewalTime) {
        this.renewalTime = renewalTime;
    }

    public Date getRenewalTime() {
        return renewalTime;
    }

    @JSONField(name = "remark")
    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRemark() {
        return remark;
    }

    @JSONField(name = "status")
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }

    @JSONField(name = "return_time")
    public void setReturnTime(Date returnTime) {
        this.returnTime = returnTime;
    }

    public Date getReturnTime() {
        return returnTime;
    }

    @JSONField(name = "create_by")
    public void setCreateBy(Long createBy) {
        this.createBy = createBy;
    }

    public Long getCreateBy() {
        return createBy;
    }

    @JSONField(name = "create_time")
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    @JSONField(name = "update_by")
    public void setUpdateBy(Long updateBy) {
        this.updateBy = updateBy;
    }

    public Long getUpdateBy() {
        return updateBy;
    }

    @JSONField(name = "update_time")
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public Integer getLongTerm() {
        return longTerm;
    }

    @JSONField(name = "long_term")
    public void setLongTerm(Integer longTerm) {
        this.longTerm = longTerm;
    }

    public boolean getDisable(){
        if(getValidityEndTime() == null){
            return false;
        }
        return getValidityEndTime().getTime() < new Date().getTime();
    }
}
